<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> 
<title>后台登录</title>
<link type="text/css" rel="stylesheet" href="/kuxuan/css/default.css" />
<!--必要样式-->
<link type="text/css" rel="stylesheet" href="/kuxuan/css/styles.css" />
<link type="text/css" rel="stylesheet" href="/kuxuan/css/demo.css" />
<link type="text/css" rel="stylesheet" href="/kuxuan/css/loaders.css" />
</head>

<body>
<div class='login'>
	<div class='login_title'>
		<span>管理员登录</span>
	</div>
	<div class='login_fields'>
	    <div class='login_fields__user'>
	      <div class='icon'>
	        <img alt="" src='/kuxuan/img/user_icon_copy.png'>
	      </div>
	      <input name="name" placeholder='用户名' maxlength="16" type='text' autocomplete="off" value=""/>
	      <div class='validation'>
	        <img alt="" src='/kuxuan/img/tick.png'>
	      </div>
	    </div>
	    <div class='login_fields__password'>
	      <div class='icon'>
	        <img alt="" src='/kuxuan/img/lock_icon_copy.png'>
	      </div>
	      <input name="pwd" placeholder='密码' maxlength="16" type='text' autocomplete="off">
	      <div class='validation'>
	        <img alt="" src='/kuxuan/img/tick.png'>
	      </div>
	    </div>
	    <div class='login_fields__submit'>
	      <input type='button' value='登录'>
	    </div>
	</div>
	<div class='success'></div>
	<div class='disclaimer'>
	    <p>欢迎登陆后台管理系统</p>
	</div>
</div>
<div class='authent'>
  <div class="loader" style="height: 44px;width: 44px;margin-left: 28px;">
    <div class="loader-inner ball-clip-rotate-multiple">
        <div></div>
        <div></div>
        <div></div>
    </div>
    </div>
  <p>验证登录中...</p>
</div>
<div class="OverWindows"></div>

<link type="text/css" rel="stylesheet" href="/layui/css/layui.css" />
<script type="text/javascript" src="/kuxuan/js/jquery.min.js"></script>
<script type="text/javascript" src="/kuxuan/js/jquery-ui.min.js"></script>
<script type="text/javascript" src='/kuxuan/js/stopExecutionOnTimeout.js?t=1'></script>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/kuxuan/js/particleground.js"></script>
<script type="text/javascript" src="/kuxuan/js/treatment.js"></script>
<script type="text/javascript" src="/kuxuan/js/jquery.mockjax.js"></script>
<script type="text/javascript">
$(document).keypress(function (e) {
    // 回车键事件  
    if (e.which == 13) {
        $('input[type="button"]').click();
    }
});
//粒子背景特效
$('body').particleground({
    dotColor: '#E8DFE8',
    lineColor: '#133b88'
});
$('input[name="pwd"]').focus(function () {
    $(this).attr('type', 'password');
});
$('input[type="text"]').focus(function () {
    $(this).prev().animate({ 'opacity': '1' }, 200);
});
$('input[type="text"],input[type="password"]').blur(function () {
    $(this).prev().animate({ 'opacity': '.5' }, 200);
});
$('input[name="login"],input[name="pwd"]').keyup(function () {
    var Len = $(this).val().length;
    if (!$(this).val() == '' && Len >= 5) {
        $(this).next().animate({
            'opacity': '1',
            'right': '30'
        }, 200);
    } else {
        $(this).next().animate({
            'opacity': '0',
            'right': '20'
        }, 200);
    }
});
var open = 0;
layui.use('layer', function () {
    //非空验证
    $('input[type="button"]').click(function () {
        var name = $('input[name="name"]').val();
        var pwd = $('input[name="pwd"]').val();
        if (name == '') {
            ErroAlert('请输入您的账号');
        } else if (pwd == '') {
            ErroAlert('请输入密码');
        } else {
            //认证中..
            fullscreen();
            $('.login').addClass('test'); //倾斜特效
            setTimeout(function () {
                $('.login').addClass('testtwo'); //平移特效
            }, 300);
            setTimeout(function () {
                $('.authent').show().animate({ right: -320 }, {
                    easing: 'easeOutQuint',
                    duration: 600,
                    queue: false
                });
                $('.authent').animate({ opacity: 1 }, {
                    duration: 200,
                    queue: false
                }).addClass('visible');
            }, 500);

            //登陆
            var JsonData = { name: name, pwd: pwd,'_token':"{{ csrf_token() }}" };
			//此处做为ajax内部判断
            $.post("{{url('admin/login')}}", JsonData,function (data) {
                    //ajax返回
                    //认证完成
                    setTimeout(function () {
                        $('.authent').show().animate({ right: 90 }, {
                            easing: 'easeOutQuint',
                            duration: 600,
                            queue: false
                        });
                        $('.authent').animate({ opacity: 0 }, {
                            duration: 200,
                            queue: false
                        }).addClass('visible');
                        $('.login').removeClass('testtwo'); //平移特效
                    }, 2000);
                    setTimeout(function () {
                        $('.authent').hide();
                        $('.login').removeClass('test');
                        if (data.Status == 'ok') {
                            //登录成功
                            $('.login div').fadeOut(100);
                            $('.success').fadeIn(1000);
                            $('.success').html(data.Text);
							//跳转操作
                            setTimeout(function () {
                                location="/admin"
                            }, 1000);
                        } else {
                            AjaxErro(data);
                        }
                    }, 2400);
            	})
        }
    })
})
var fullscreen = function () {
    elem = document.body;
    if (elem.webkitRequestFullScreen) {
        elem.webkitRequestFullScreen();
    } else if (elem.mozRequestFullScreen) {
        elem.mozRequestFullScreen();
    } else if (elem.requestFullScreen) {
        elem.requestFullscreen();
    } else {
        //浏览器不支持全屏API或已被禁用
    }
}
</script>
</body>
</html>